<template>
	<view>
		<view class="shop">
			<image :src="initData.image" mode="aspectFill"  />
			<view class="text">
				<view class="name">货号：{{initData.productSn}}</view>
				<view class="trait">分类：{{}}</view>
				<view class="trait" v-for="(item,index) in initData.sku" :key="index">{{item}}</view>
				<view class="trait">供应商：{{initData.supplier}}</view>
				<view class="trait">操作时间： 2019-07-15 12:12:34</view>
			</view>
		</view>
		<view class="msg">
			<view class="trait">
				<text>商品数量：</text>
				1件
			</view>
			<view class="trait">
				<text>商品货号：</text>
			{{initData.productSn}}
			</view>
			<view class="trait">
				<text>商品状态：</text>
				{{initData.productStatus.desp}}
			</view>
			<view class="trait" v-if="style==1">
				<text>换货人：</text>
				{{initData.realName}}
			</view>
			<view class="trait" v-if="style==1">
				<text>换货时间：</text>
				{{initData.createdTime}}
			</view>
			<!-- TODO接口需要进行重新编写 -->
			<view class="trait" v-if="style==1">
				<text>货品去向：</text>
				ERP仓
			</view>
			<view class="trait" v-if="style==2">
				<text>退款人：</text>
				李耀文
			</view>
			<view class="trait" v-if="style==2">
				<text>退款时间：</text>
				2019-07-15 12:12:34
			</view>
			<view class="trait" v-if="style==2">
				<text>退款金额：</text>
				{{initData.costPrice}}
			</view>
		</view>
		<view class="ordermsg">
			<view class="title">原商品订单信息</view>
			<image src="/static/img/logo2.png" mode=" widthFix"></image>
			<view class="li">
				<text>订单号：</text>
				{{initData.chgGoodsSn}}
			</view>
			<view class="li">
				<text>商品货号：</text>
				{{initData.chgProductSn}}
			</view>
			<view class="li">
				<text>供应商信息：</text>
				如意裁缝店
			</view>
			<view class="li">
				<text>数量：</text>
				1件
			</view>
			<view class="li">
				<text>客户名称：</text>
				何丽娟
			</view>
			<view class="li">
				<text>联系电话：</text>
				136****6544
			</view>
			<view class="li">
				<text>订单来源：</text>
				{{chgGoodsCatName}}
			</view>
			<view class="li">
				<text>下单时间：</text>
				2019-07-01 10:00:00
			</view>
			<view class="li">
				<text>审核时间：</text>
				2019-07-01 10:00:00
			</view>
			<view class="li">
				<text>身高：</text>
				170CM
			</view>
			<view class="li">
				<text>体重：</text>
				50KG
			</view>
			<view class="li" v-for="(item1,index1) in initData.sku2" :key="index1"><text>{{item1}}</text></view>
			
		
			<view class="li">
				<text>下单人：</text>
				李宏伟
			</view>
			<view class="li">
				<text>所属代理：</text>
				代理商A
			</view>
			<view class="li">
				<text>收货地址：</text>
				广东省深圳市南山区永平路187号建业大厦15楼...
			</view>
			<view class="li">
				<text>快递单号：</text>
				SF123456789789
			</view>
			<view class="li">
				<text>状态：</text>
				已换货
			</view>
			<view class="li">
				<text>仓库：</text>
				外采仓
			</view>
			<view class="li">
				<text>客服名称：</text>
				客服A
			</view>
			<view class="li">
				<text>发货员：</text>
				发货员A
			</view>
			<view class="li">
				<text>发货时间：</text>
				2019-07-01 11:00:00
			</view>
			<view class="li">
				<text>操作时间：</text>
				2019-07-01 11:00:00
			</view>
			<view class="li">
				<text>备注：</text>
				尽快发货
			</view>
			<view class="li">
				<text>客服备注：</text>
				身高为175CM
			</view>
		</view>
		<view class="go-top" v-show="is_go_top" @click="backTop"><image src="/static/img/go_top.png" /></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			is_go_top: false,
			style:0,
			initData:''
		};
	},
	mounted() {
		var _this = this
		uni.getStorage({
		    key: 'goodsdetails',
		    success: function (res) {
		        _this.id = res.data;
				_this.getData(_this.id+'');
		    }
		});
	},
	onPageScroll: function(e) {
		//nvue暂不支持滚动监听，可用bindingx代替
		if (e.scrollTop > 200) {
			this.is_go_top = true;
		} else {
			this.is_go_top = false;
		}
	},
	methods: {
		getData(e){
			entrepot
				.goodsdetails(e)
				.then(res => {
					this.initData=res.data;
					this.ininData.img=this.imgCDNUrl+res.data.productImg;
					this.ininData.changimg=this.imgCDNUrl+res.data.chgProductImg;
					var sku2=[];
					if(this.ininData.productSkuDesp){
						sku2=this.ininData.productSkuDesp.split(",");
					}
					this.ininData.sku2=sku2;
					var sku=[];
					if(this.ininData.spec){
						sku=this.ininData.spec.split(",");
					}
					this.ininData.sku=sku;
				})
				.catch(err =>  {
					console.log(new Error('请检查网络后重试'));
				});
			
		},
		// 计算距离顶部的高度，均分10等分，
		backTop() {
			uni.pageScrollTo({
				scrollTop: 0,
				duration: 200
			});
		}
	}
};
</script>

<style lang="less" scoped>
page {
	background: #fff;
}
.shop {
	padding: 50rpx 20rpx;
	display: flex;
	font-size: 26rpx;
	line-height: 44rpx;
	image {
		width: 244rpx;
		height: 244rpx;
		border-radius: 10rpx;
		margin-right: 28rpx;
	}
	.text {
		.trait {
			color: #999;
			font-size: 24rpx;
		}
	}
}
.msg {
	padding: 0 20rpx;
	.trait {
		color: #999;
		font-size: 26rpx;
		line-height: 66rpx;
		text {
			color: #333333;
		}
	}
}
.ordermsg {
	border-top: 26rpx solid #f6f6f6;
	padding: 20rpx;
	.title {
		font-size: 28rpx;
		border-left: 5rpx solid #bd3c8c;
		padding-left: 16rpx;
		line-height: 30rpx;
	}
	image {
		display: block;
		margin: 58rpx auto;
		width: 467rpx;
		border: 1px solid #efefef;
		box-sizing: border-box;
		padding: 13rpx;
	}
	.li {
		font-size: 24rpx;
		color: #999;
		line-height: 72rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		text {
			display: inline-block;
			width: 182rpx;
			color: #333;
			text-align-last: justify;
			padding-right: 20rpx;
		}
	}
}
</style>
